import { fromJS } from 'immutable'
import * as types from './action-types'

const defaultState = fromJS({
  codeText: '',
  loading: false
})

export default (state = defaultState, action) => {
  switch (action.type) {
    case types['SET_CODE_TEXT']:
      return state.set('codeText', action.value)
    case types['CHANGE_LOADING']:
      return state.set('loading', action.bol)
    default:
      return state
  }
}
